package com.prs.crm.dao.hr.impl;

import java.sql.SQLException;
import java.util.Collection;
import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
import org.springframework.orm.hibernate3.HibernateCallback;

import com.prs.crm.dao.hr.ResumeDao;
import com.prs.crm.dao.impl.BaseDaoImpl;
import com.prs.crm.domain.hr.Resume;

public class ResumeDaoImpl extends BaseDaoImpl<Resume> implements ResumeDao{

	@Override
	public Collection<Resume> getAllResume() {
		// TODO Auto-generated method stub
		Criteria criteria = this.getSession().createCriteria(Resume.class);
		return criteria.list();
	}

	@Override
	public Collection<Resume> getResumeByIds(Collection<Integer> ids) {
		// TODO Auto-generated method stub
		Criteria criteria = this.getSession().createCriteria(Resume.class);
		criteria.add(Restrictions.in("id", ids));
		return criteria.list();
	}

	@Override
	public Resume getResumeByid(String name) {
		Criteria criteria = this.getSession().createCriteria(Resume.class)
		.add(Restrictions.eq("name", name));
		List<Resume> list = criteria.list();
		if(list.size() == 0){
			return null;
		}
		return list.get(0);
	}
}
